using System;

namespace SimplePMT.Components
{
	public static class CalendarInput
	{
        public static string Calendar(string id)
        {
            return Calendar(id, DateTime.Now.ToShortDateString());
        }

		public static string Calendar(string id, string date) {
            return "<input type=\"text\" size=\"15\" id=\"" + id + "\" name=\"" + id + "\" value=\"" + date + "\" style=\"vertical-align:middle;\"></input>&nbsp;<img border=\"0\" id=\"" + id + "CalendarImage\" src=\"images/calendar.gif\" style=\"cursor:pointer;vertical-align:middle;\"></img><script>Calendar.setup({inputField : '" + id + "',ifFormat : '%m/%d/%Y', button : '" + id + "CalendarImage'	});</script>";
        }

        public static string Calendar(string id, DateTime? date)
        {
            string tmpDate = DateTime.Now.ToShortDateString();
            if (date.HasValue)
            {
                tmpDate = date.Value.ToShortDateString();
            }
            return Calendar(id, tmpDate);
        }

	}
}
